package com.yxw.live_vod_backend_boot.controller;

import com.yxw.live_vod_backend_boot.dto.WithdrawalRecordAddDTO;
import com.yxw.live_vod_backend_boot.dto.WithdrawalRecordQueryDTO;
import com.yxw.live_vod_backend_boot.service.WithdrawalRecordService;
import com.yxw.live_vod_backend_boot.vo.WithdrawalRecordVO;
import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.helper.ResultHelper;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 店铺提现记录
 * @author xiexuxin
 * @date 2024-01-03
 */
@RestController
@Api(value = "店铺提现记录", tags = "店铺提现记录")
@Slf4j
@RequestMapping("/api/withdrawal_record")
public class WithdrawalRecordController {

    @Autowired
    private WithdrawalRecordService withdrawalRecordService;

    @ApiOperation(value = "新增提现记录")
    @PostMapping(value = "/add_withdrawal_record")
    public BaseResult addWithdrawalRecord(@RequestBody WithdrawalRecordAddDTO dto){
        withdrawalRecordService.addWithdrawalRecord(dto);
        return BaseResult.doSuccess(null, "添加成功");
    }

    @ApiOperation(value = "获取提现记录详情")
    @PostMapping(value = "/get_withdrawal_record_by_id")
    public BaseResult getWithdrawalRecordById(@RequestParam("id") Long id){
        WithdrawalRecordVO vo = withdrawalRecordService.getWithdrawalRecordById(id);
        return BaseResult.doSuccess(vo, "查询成功");
    }

    @ApiOperation(value = "获取提现记录列表")
    @PostMapping(value = "/get_withdrawal_record_list")
    public BaseResult<PageVO<WithdrawalRecordVO>> getWithdrawalRecordList(@RequestBody WithdrawalRecordQueryDTO dto){
        PageVO<WithdrawalRecordVO> pageVo = withdrawalRecordService.getWithdrawalRecordList(dto);
        return ResultHelper.fillWithSuccess(pageVo);
    }

}
